home *** CD-ROM | disk | FTP | other *** search
- /* lock.c */
-
- /* Copyright © 1989 by Donald T. Meyer, Stormgate Software
- * All Rights Reserved
- */
-
-
-
- #include "rxil.h"
-
-
-
- /* NAME
- * RxilCmdLock
- *
- * SYNOPSIS
- * RxilCmdLock( rexxmsg );
- *
- * struct RexxMsg *rexxmsg;
- *
- * FUNCTION
- * This is a "command" which would be called from the dispatch
- * function. This would handle the "LOCK" command that an ARexx
- * program could send to the application requesting access to
- * the private port.
- *
- * INPUTS
- * rexxmsg A pointer to a RexxMsg structure.
- *
- * RESULT
- * None
- *
- * SIDES
- *
- * HISTORY
- * 01-Aug-89 Creation.
- *
- * BUGS
- *
- * SEE ALSO
- * RxilCmdUnlock()
- */
-
- void RxilCmdLock( struct RexxMsg *rexxmsg )
- {
- /* Check for wether or not the program which issued this command is
- * set to receive a result string (options results).
- * Normally this would be handled downstream by RxilCheckResult()
- * but in this case we need to know wether or not to set the
- * locked flag. Why do we need to know this? Because we don't
- * want to lock if the external program won't be able to receive
- * our adrress (and therefore never UNlock us!).
- */
- if( FlagIsClear( rexxmsg->rm_Action, RXFF_RESULT ) )
- {
- rexxmsg->rm_Result1 = RXERR_REQUIRES_RESULT_FLAG;
- return;
- }
-
-
- if( global_rdef->LockCount != 0 )
- {
- /* We are already locked. Return a failure code. */
- rexxmsg->rm_Result1 = RXERR_ALREADY_LOCKED;
- }
- else
- {
- RxilSetResult( rexxmsg, global_rdef->SecretPortName );
- ++global_rdef->LockCount;
- }
- }
-
-
-
- /* NAME
- * RxilCmdUnlock
- *
- * SYNOPSIS
- * RxilCmdUnlock( rexxmsg );
- *
- * struct RexxMsg *rexxmsg;
- *
- * FUNCTION
- * This is a "command" which would be called from the dispatch
- * function. This would handle the "UNLOCK" command that an
- * ARexx program could send to the application requesting
- * access to the private port.
- *
- * Note: The privilege level for this command should be "secret",
- * since anyone who locked us will be able to meet that level,
- * and those who have not locked us can't slip the lock out
- * from under those who did (so to speak).
- *
- * INPUTS
- * rexxmsg A pointer to a RexxMsg structure.
- *
- * RESULT
- * None
- *
- * SIDES
- *
- * HISTORY
- * 01-Aug-89 Creation.
- *
- * BUGS
- *
- * SEE ALSO
- * RxilCmdLock()
- */
-
- void RxilCmdUnlock( struct RexxMsg *rexxmsg )
- {
- if( global_rdef->LockCount != 0 )
- {
- /* We are already locked. This is a valid command. */
- --global_rdef->LockCount;
- }
- else
- {
- /* We are not locked. Tell caller about their error. */
- rexxmsg->rm_Result1 = RXERR_NOTHING_TO_UNLOCK;
- }
- }
-
-